<?php
//修改信息
error_reporting(E_ALL^E_WARNING);//隐藏除warning以为的错误警告
//连接数据库
$conn = mysqli_connect
('127.0.0.1','root','colourdragon','studentt');
//设置字符集
mysqli_query($conn,"set names utf8");

$student_id=$_GET['id'];
//sql语句
$sql = "select * from `user` where `id`=$student_id";
//执行sql语句
$res = mysqli_query($conn,$sql);
//将查询到的要修改的那行信息转为数组
$row = mysqli_fetch_assoc($res);
?>


<html>
<head>
    <title>修改学生信息</title>

</head>
<!--创建一个修改信息用的表单,把收集的信息传给update.php-->
<h1>修改信息</h1>
<form action="update.php" method="post">
    <table border="1" width="300">
        <tr>
            <th>学生名称</th><td><input type="text" name="name" value="<?php echo $row['name'] ?>"></td>
        </tr>
        <tr>
            <th>学生成绩</th><td><input type="text" name="score" value="<?php echo $row['score'] ?>"></td>
        </tr>
        <input type="text" name="id" value="<?php echo $row['id'] ?>" hidden><!--hidden是隐藏这条信息的意思-->
        <tr>
            <td colspan="2" align="center"><input type="submit" name='submit' value="提交">&nbsp;&nbsp;&nbsp;&nbsp; <input type="reset" value="取消"></td>

        </tr>
    </table>
    <a href="index.php">返回</a>

</form>
</html>
